/**
 *	@file	scr_field_sub.c
 *	@brief	フィールドスクリプトコマンド(field_sub_fieldオーバーレイ)
 *
 *	@author	Miyuki Iwasawa
 *	@date	08.07.29
 *
 *	フィールド起動でジムと平行でいいものをいれておく
 */

#include "common.h"
#include "gflib/msg_print.h"
#include "system/lib_pack.h"
#include "system/window.h"
#include "savedata/frontier_savedata.h"
#include "savedata/frontier_ex.h"
#include "savedata/savedata_def.h"
#include "savedata/misc.h"
#include "fieldsys.h"
#include "zonedata.h"
#include "mapdefine.h"
#include "poketool/monsno.h"
#include "field/eventflag.h"							//EventWork_CheckEventFlag
#include "field/evwkdef.h"								//FH_FLAG_START
#include "field/fieldobj.h"
#include "script.h"										//ID_HIDE_ITEM_SCR_OFFSET
#include "scr_tool.h"
#include "field_demo.h"

#include "system/wipe.h"

#include "scrcmd_def.h"
#include "ev_win.h"
#include "scr_field.h"
#include "msgdata\msg.naix"								//NARC_msg_??_dat
#include "msgdata\msg_ev_win.h"

#include "system/msgdata.h"								//MSGMAN_TYPE_DIRECT
#include "system/pm_str.h"
#include "system/fontproc.h"
#include "system/snd_tool.h"
#include "system/bmp_list.h"
#include "fieldmap.h"
#include "fld_bmp.h"
#include "syswork.h"
#include "sysflag.h"

#include	"itemtool/item.h"
#include	"itemtool/itemequip.h"
#include	"itemtool/itemsym.h"

#include "../fielddata/build_model/build_model_id.h"
#include "../../include/pl_bugfix.h"

#include "scr_field_sub.h"

static void AjitoD35R0103_BMAnimeSet(FIELDSYS_WORK* fsys,u8 id);

//--------------------------------------------------------------
/**
 * @brief	ロケット団アジトB2専用 電波発生装置アニメ制御
 *
 * @param	none
 *
 * @retval	1
 */
//--------------------------------------------------------------
BOOL EvCmdAjitoD35R0103BMInit( VM_MACHINE * core )
{
	int i = 0;

	for(i = 0;i < 3;i++){
		AjitoD35R0103_BMAnimeSet(core->fsys,i);
	}
	return 0;
}

#define EW_GENELATOR_X	(29)
#define EW_GENELATOR_Z	(11)
#define EW_GENELATOR_SX	(6)
#define EW_GENELATOR_SZ	(2)

#define AJI_MECH_ANIME_ENTRY_ID	(1)

/**
 *	@brief	ロケット団アジトB2専用 電波発生装置アニメセット
 */
static void AjitoD35R0103_BMAnimeSet(FIELDSYS_WORK* fsys,u8 id)
{
	F_OBJ_DATA	*data;
	static const u16 mech_tbl[] = {BMID_ROOM_AJI_MECH01,BMID_ROOM_AJI_MECH02,BMID_ROOM_AJI_MECH03};
#if 1
	data = F_RES_OBJ_GetRenderObjPtr(fsys->FldResObjMng, mech_tbl[id]);
	if(data == NULL){
		GF_ASSERT_MSG(0,"電波発生装置OBJ %d が見つかりません\n",id);
		return;
	}
	F3DA_SetFld3DAnime(	mech_tbl[id],
		SysFlag_D35R0103Ajito_MechStopCheck(SaveData_GetEventWork(fsys->savedata),id), TRUE,
		&data->RenderObj,fsys->field_3d_anime );	//有効
#endif
}
